$(function(){
    showOwnerInfo();
});

function showOwnerInfo(){
    API.get('pharmacy_owner',{pharmacy:getParam('pharmacy')},ownerShow);
}

function ownerShow(msg,getStatus){
    if(getStatus){
        for(key in msg){
            $('#'+key).text(msg[key]);
        }
        var gou = '<div class="gou"></div>';
        var no_gou = '<div class="no-gou"></div>';
        $('#owner_info_avatar').append('<img src="' + msg.owner_info.avatar +  '" width="50px" height="50px"/>');
        $('#owner_info_nickname').text(msg.owner_info.nickname);
        $('#owner_info_mobile').text(msg.owner_info.mobile);
        $('#corporation_card_forward').append('<a href="javascript:void(0)" onclick="showBigPic($(this))" data-src="' +  ((msg.corporation_card.forward.indexOf('http://')) ? IMG_PREFIX+msg.corporation_card.forward : msg.corporation_card.forward)  + '">点击查看身份证正面</a>');
        $('#corporation_card_back').append('<a href="javascript:void(0)" onclick="showBigPic($(this))" data-src="' + ((msg.corporation_card.back.indexOf('http://')) ? IMG_PREFIX+msg.corporation_card.back : msg.corporation_card.back) + '">点击查看身份证反面</a>');
        $('#buy_chinese_drug').empty().append((msg.buy_chinese_drug == true) ? gou : no_gou);
        $('#doctor_inside').empty().append((msg.doctor_inside == true) ? gou : no_gou);
        $('#medicine_drug').empty().append((msg.medicine_drug == true) ? gou : no_gou);
        $('#send_drug').empty().append((msg.send_drug == true) ? gou: no_gou);
        $('#support_yibao').empty().append((msg.support_yibao == true) ? gou : no_gou);
        $('#all_day').empty().append((msg.all_day == true) ? gou : no_gou);
        td_info = '';
        for(var i=0;i<msg.work_days.length;i++) {
            if (msg.work_days[i] == '1') {
                td_info += '<span class="green_block"></span>'
            } else {
                td_info += '<span class="gray_block"></span>'
            }
        }
        $('#work_days').empty().append(td_info);
        if(msg.banner){
            $('#banner').attr('src',((msg.banner.indexOf('http://')) ? IMG_PREFIX + msg.banner : msg.banner));
        }

        $('#license_profile').attr('src',(( msg.license_profile[0].indexOf('http://') ) ? IMG_PREFIX + msg.license_profile[0] : msg.license_profile[0]));

    }else{
        getNoneReplay();
    }
}
